package main

import (
	
	"github.com/astaxie/beego"
	_ "kukukaki/routers"
	_ "kukukaki/db"
	"kukukaki/models"
	 "fmt"
	 "encoding/json"
	  "github.com/astaxie/beego/logs"
)



func main() {
	initLogger()
	 //beego.BeeLogger.DelLogger("console")
	beego.Run()
    err :=models.SysCacheInit()
    if err != nil {
        beego.Error(err.Error())
    }else{
    	 beego.Info("syscache init ok")
    }

}


func initLogger()(err error) {
	//beego.SetLevel(beego.LevelInformational)
    config := make(map[string]interface{})
    config["filename"] = beego.AppConfig.String("log_path")

    // map 转 json
    configStr, err := json.Marshal(config)
    if err != nil {
        fmt.Println("initLogger failed, marshal err:", err)
        return
    }
    // log 的配置
    beego.SetLogger(logs.AdapterFile, string(configStr))
    // log打印文件名和行数
    beego.SetLogFuncCall(true)
    fmt.Println(string(configStr))
    return
}


 